<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>props</title>
  </head>
  <div id="app"></div>

  <body>
    <script src="../../public/js/react.development.js"></script>
    <script src="../../public/js/react-dom.development.js"></script>
    <script src="../../public/js/babel.min.js"></script>
    <script src="../../public/js/prop-types.js"></script>
    <script type="text/babel">
         class Person extends React.Component {
           static propTypes = {
             name: PropTypes.string.isRequired,
             age: PropTypes.number,
             speak: PropTypes.fun,
           };
           render() {
             const { name, age, speak } = this.props;
             return (
               <ul onClick={speak}>
                 <li>名字:{name}</li>
                 <li>年龄:{age}</li>
               </ul>
             );
           }
         }
         const p = { name: "doki", age: 18 };
         function speak() {s
					console.log(this.name)
				}
         ReactDOM.render(<Person {...p} speak={speak}} />, document.getElementById("app"));
    </script>
  </body>
</html>
